package com.qwz.example;

import com.qwz.example.component.Component;

import java.util.Date;
/**  
* @Description: 装饰品的接口，需要和被装饰的对象实现同样的接口
* @Package com.qwz.example.Decorator
* @author Qiuwuzhi
* @date 2019/12/19 13:27
* @version V1.0
*/
public abstract class Decorator implements Component{
    /**
     * 持有被装饰的组件对象
     */
    protected Component component;

    /**
     * 通过构造方法传入被装饰的对象
     * @param component
     */
    public Decorator(Component component) {
        this.component = component;
    }

    public double calcPrize(String user, Date begin, Date end) {
        //转调组件对象的方法
        return component.calcPrize(user,begin,end);
    }
}
